
import requests
from lxml import etree

maps = lambda x : x[0] if x else x

def get_data():
    headers = {
        'User-Agent': 'xxx'
    }
    url = 'https://www.icswb.com/channel-list-channel-162.html'
    res = requests.get(url, headers=headers)
    html = etree.HTML(res.text)
    li = html.xpath('//ul[@id="NewsListContainer"]/li')
    for ii in li:
        title = ii.xpath('./h3/a/text()')
        href = maps(ii.xpath('./a/@href'))
        print(title, href)

if __name__ == '__main__':
    get_data()